<script>
  // #1
  function func(num) {
    return function () {
      // #2
      console.log(num)
    };
  }
  setTimeout(func(1));

  async function async3() {
    await async4();
    // #3
    console.log(8);
  }
  async function async4() {
    console.log(5)
  }
  async3();
  function func2() {
    // #4
    console.log(2);
    async function async1() {
      await async2();
      // #7
      console.log(9)
    }
    async function async2() {
      console.log(5)
    }
    async1();
    setTimeout(func(4))
  }
  setTimeout(func2);

  setTimeout(func(3));

  new Promise(resolve => {
    console.log('Promise');
    resolve()
  })
    .then(() => console.log(6)) // #5
    .then(() => console.log(7)); // #6
  console.log(0);
</script>